//只是一次性读写
#include"func.h"
int main(int argc,char *argv[]){
    // ./my_cpy file3 file4
    ARGS_CHECK(argc,3);
    int fdr = open(argv[1],O_RDONLY);
    ERROR_CHECK(fdr,-1,"open");
    int fdw = open(argv[2],O_WRONLY|O_CREAT|O_TRUNC,0666);
    ERROR_CHECK(fdw,-1,"open");
    
    char buff[1024]={0};
    ssize_t sret = read(fdr,buff,sizeof(buff));
    //有多少写多少，所以直接调用sret能够将所有的数据都写入到fdw中
    write(fdw,buff,sret);

    close(fdr);
    close(fdw);
    return 0;

}
